.container {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  padding: 24px;
  position: relative;

  .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
  }

  .content {
    display: flex;
    position: relative;
  }

  .tableContainer {
    flex: 1;
    transition: width 0.3s ease;

    &.withDiagnosis {
      width: calc(100% - 424px);
    }

    :global {
      .ant-table-wrapper {
        .ant-table {
          .ant-table-container {
            .ant-table-content {
              overflow-x: auto;
            }
          }
        }
      }

      .ant-empty {
        padding: 32px 0;
      }

      .ant-skeleton {
        padding: 24px 0;
      }
    }
  }

  .diagnosisPanel {
    position: relative;
    width: 400px;
    background-color: #fff;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    margin-left: 24px;
    display: flex;
    flex-direction: column;
    min-height: 200px;
    max-height: min(100%, 600px);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);

    .diagnosisHeader {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 12px 16px;
      border-bottom: 1px solid #f0f0f0;
      font-weight: 500;
      color: #1f2937;
      background: #fafafa;
      border-top-left-radius: 8px;
      border-top-right-radius: 8px;
    }

    .diagnosisContent {
      flex: 1;
      overflow-y: auto;
      padding: 16px;
      font-size: 14px;
      line-height: 1.6;
      color: #1f2937;

      &::-webkit-scrollbar {
        width: 6px;
        height: 6px;
      }

      &::-webkit-scrollbar-track {
        background: #f5f5f5;
        border-radius: 3px;
      }

      &::-webkit-scrollbar-thumb {
        background: #ccc;
        border-radius: 3px;

        &:hover {
          background: #999;
        }
      }

      .diagnosisLoading {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-height: 150px;
        gap: 16px;
        color: #6b7280;
      }
    }
  }
}

.typeFilter {
  width: 160px;
  transition: all 0.2s ease;

  &:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  }

  :global {
    .ant-select-selector {
      border-radius: 6px !important;
      border-color: #e5e7eb !important;
      transition: all 0.3s ease;

      &:hover {
        border-color: #2f54eb !important;
      }
    }
  }
}

.error {
  margin-bottom: 20px;
  border-radius: 6px;
}

.searchInput {
  width: 240px;
  margin-right: 16px;
  transition: all 0.3s ease;

  &:hover {
    box-shadow: 0 0 0 2px rgba(47, 84, 235, 0.1);
  }

  &:focus {
    transform: translateY(-1px);
  }

  :global {
    .ant-input-affix-wrapper {
      border-radius: 6px;
      border-color: #e5e7eb;
      transition: all 0.3s ease;

      &:hover,
      &:focus {
        border-color: #2f54eb;
      }

      .ant-input-prefix {
        color: #999;
        margin-right: 8px;
      }
    }
  }
}

.toolBar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  width: 100%;
  padding-bottom: 16px;
  border-bottom: 1px solid #f0f0f0;

  &:empty {
    padding: 0;
    border-bottom: none;
  }

  .searchInput {
    width: 240px;
  }

  .typeFilter {
    width: 160px;
  }

  .actionButton {
    height: 32px;
    width: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border-radius: 6px;
    transition: all 0.2s ease;

    .anticon {
      font-size: 16px;
    }

    &:hover {
      background: rgba(0, 0, 0, 0.06);
    }

    &:active {
      background: rgba(0, 0, 0, 0.1);
    }

    &[disabled] {
      color: rgba(0, 0, 0, 0.25);
      background: transparent;
      cursor: not-allowed;
    }

    .magicWand {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: 20px;
      background: linear-gradient(135deg, #722ed1 0%, #1890ff 100%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      transform: rotate(-15deg);
      transition: all 0.3s ease;
      filter: drop-shadow(0 0 2px rgba(114, 46, 209, 0.3));
      position: relative;

      &::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(
          135deg,
          #722ed1 0%,
          #1890ff 100%
        );
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        opacity: 0.5;
        filter: blur(4px);
        transform: scale(1.2);
        z-index: -1;
      }
    }

    &:not(:disabled) {
      &:hover {
        background: rgba(114, 46, 209, 0.08);

        .magicWand {
          transform: rotate(0deg) scale(1.2);
          filter: drop-shadow(0 0 4px rgba(114, 46, 209, 0.5));

          &::before {
            opacity: 0.8;
            transform: scale(1.4);
            filter: blur(6px);
          }
        }
      }

      &:active {
        background: rgba(114, 46, 209, 0.12);

        .magicWand {
          transform: rotate(-25deg) scale(0.95);
          filter: drop-shadow(0 0 2px rgba(114, 46, 209, 0.3));

          &::before {
            opacity: 0.3;
            transform: scale(1.1);
            filter: blur(3px);
          }
        }
      }
    }

    &.ant-btn-loading .magicWand {
      opacity: 0;
    }
  }

  .aiDiagnosisIcon {
    font-size: 16px;
    background: linear-gradient(45deg, #1890ff, #722ed1);
    -webkit-background-clip: text;
    color: transparent;
  }
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 2px;
  background: #fafafa;
  border: 1px solid #f0f0f0;
  font-size: 12px;
  line-height: 20px;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);

  &:hover {
    transform: scale(1.05);
  }
}

.typeTag {
  min-width: 54px;
  position: relative;
  overflow: hidden;

  &.normal {
    background: #f6ffed;
    border-color: #b7eb8f;
    color: #52c41a;

    &:hover {
      background: #f6ffed;
    }
  }

  &.warning {
    background: #fff2e8;
    border-color: #ffbb96;
    color: #fa541c;

    &:hover {
      background: #fff7e6;
    }
  }

  &::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
      120deg,
      transparent,
      rgba(255, 255, 255, 0.6),
      transparent
    );
    transform: translateX(-100%);
  }

  &:hover::after {
    transition: transform 0.6s;
    transform: translateX(100%);
  }
}

.countTag {
  min-width: 32px;
  background: #f0f5ff;
  border-color: #d6e4ff;
  color: #2f54eb;

  &:hover {
    animation: pulse 1s;
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

:global {
  .ant-table-wrapper {
    .ant-table {
      background: transparent;

      .ant-table-thead > tr > th {
        background: #fafafa;
        font-weight: 500;
        border-bottom: 1px solid #f0f0f0;
        padding: 12px 16px;
      }

      .ant-table-tbody {
        > tr {
          transition: all 0.2s ease;

          &:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
            z-index: 1;
          }

          > td {
            transition: background-color 0.2s ease;
          }
        }
      }
    }
  }

  .ant-badge {
    .ant-badge-status-dot {
      width: 8px;
      height: 8px;
    }

    .ant-badge-status-text {
      font-size: 13px;
      margin-left: 10px;
    }
  }

  .ant-spin-nested-loading {
    .ant-spin {
      max-height: none;
    }
  }

  .ant-empty {
    padding: 40px 0;

    .ant-empty-description {
      color: #666;
    }
  }

  .ant-skeleton {
    padding: 16px;
    background: #fff;
    border-radius: 8px;

    .ant-skeleton-content {
      .ant-skeleton-title {
        margin-top: 0;
      }

      .ant-skeleton-paragraph {
        margin-bottom: 0;

        > li {
          background: linear-gradient(
            90deg,
            #f5f5f5 25%,
            #e8e8e8 37%,
            #f5f5f5 63%
          );
          background-size: 400% 100%;
          animation: ant-skeleton-loading 1.4s ease infinite;
        }
      }
    }
  }
}

.aiDiagnosisIcon {
  font-size: 16px;
  background: linear-gradient(45deg, #1890ff, #722ed1);
  -webkit-background-clip: text;
  color: transparent;
}

@media (max-width: 768px) {
  .container {
    padding: 16px;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .typeFilter {
    width: 100%;
  }

  .searchInput {
    width: 100%;
    margin-right: 0;
  }

  .toolBar {
    flex-direction: column;
    align-items: stretch;
  }
}
